<template>
    <div>
        <text-picker :config="config.data[0]" />
        <card-input v-if="isIDCard" :config="config.data[1]" />
        <text-input v-else v-show="config.data[0].value!=''" :config="config.data[1]" />        
    </div>
</template>

<script>
import TextPicker from '../components/TextPicker';
import IDCardInput from '../components/IDCardInput';
import TextInput from '../components/TextInput';
export default {
    data() {
        return {
            isIDCard: false
        };
    },
    props: ['config'],
    components: {
        'text-picker': TextPicker,
        'card-input': IDCardInput,
        'text-input': TextInput
    },
    watch: {
        config: {
            handler: function(val, oldVal) {
                if (val.data[0].value == '身份证') {
                    this.isIDCard = true;
                } else {
                    this.isIDCard = false;
                }
                this.config.data[1].placeholder = '请输入' + val.data[0].value;
            },
            deep: true
        }
    }
};
</script>

<style>

</style>
